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