UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EuZ2SdTco75doKd0tORwJ4m8HCU4LzpT52WQYv6r+As='
WHERE
key_id = '938ca379de7e6c0d627cf6bb79e20593d3bbba7e516e8888d547295d405f3463'
AND (
token = 'EuZ2SdTco75doKd0tORwJ4m8HCU4LzpT52WQYv6r+As='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)