UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9Kkl2St1RpP7pDBiAGnBXp5/G0k/koUmZvvIDaP6LaM='
WHERE
key_id = 'ecb83520a9a7825f9279eef22f9bbf967a49ec1e7a3a21a4f99bcda501aca97a'
AND (
token = '9Kkl2St1RpP7pDBiAGnBXp5/G0k/koUmZvvIDaP6LaM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)