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