UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+YpMPVd+xrIOaQSOjlgvCmYaUOW6VDiejxep44fSf24='
WHERE
key_id = '001f76349f33372a8c0912a6a323a023df8cf17afc04a51117a08d509e57b4d8'
AND (
token = '+YpMPVd+xrIOaQSOjlgvCmYaUOW6VDiejxep44fSf24='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)