UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'eP7EfuRZlWu7VRM20ZHlkJQTjcz+7t/7+ZSl19ANJY0='
WHERE
key_id = 'e57940beb767c0a29ad1ba2a861648da02d5dbfda9307570f41481d5101ba4a7'
AND (
token = 'eP7EfuRZlWu7VRM20ZHlkJQTjcz+7t/7+ZSl19ANJY0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)