UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iP7JUckt0exd4PlGu3s4Kj3vxwtpuo3nyFv7EBK4+R8='
WHERE
key_id = '6dc08dadbf0409ca9fd1cc8560aad66899e4e729eabfff87aee5628b7cbd03ce'
AND (
token = 'iP7JUckt0exd4PlGu3s4Kj3vxwtpuo3nyFv7EBK4+R8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)