UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'apa8LxvonZZlZV1UgbOKfmZlfdSQS7WvNlqNBdOHueI='
WHERE
key_id = '1a0a4c050e9d0bc60552f52f08b06f08d97fb66f862c3acb0e990c8ecdf56279'
AND (
token = 'apa8LxvonZZlZV1UgbOKfmZlfdSQS7WvNlqNBdOHueI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)