UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8HE3Agn44fbyOjULN7zNFvmCoiPtPiEjjd8lZOQpN94='
WHERE
key_id = '3d942bfabd3d1a7950e0f7aa55bf154d516fc5116878296a0c5e08c8f2368107'
AND (
token = '8HE3Agn44fbyOjULN7zNFvmCoiPtPiEjjd8lZOQpN94='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)