UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fQxQwyY+KXy2ku/iIBDJQ8VrqEE3bWyKZYo/9SDsGIo='
WHERE
key_id = '507cd4cad86da3699fa3c595e86bd9ce6100d58a2e119b51bdc20cd83c4a809c'
AND (
token = 'fQxQwyY+KXy2ku/iIBDJQ8VrqEE3bWyKZYo/9SDsGIo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)