UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '52yawAzGJRtIz/FLCYmL01ORflFvhSDMUyC+87WnYUE='
WHERE
key_id = '99aa549f3c806ea3a7fc15bff1c3e6cef0bab20f5512e3a7b76a0dfd019fe358'
AND (
token = '52yawAzGJRtIz/FLCYmL01ORflFvhSDMUyC+87WnYUE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)