UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Wz862mpLAIi50oMmX9NXUmihB0VZGIQPi7TfGb5Xu58='
WHERE
key_id = 'cc77f85ebec2bb386d4db037c3e2bac567d21518e57f598b4a23250275b1b69b'
AND (
token = 'Wz862mpLAIi50oMmX9NXUmihB0VZGIQPi7TfGb5Xu58='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)