UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'emrWszI9PPli/DiB1dEnK3/ILQKlUcHVCEdrFtHKLKk='
WHERE
key_id = '18c633a34fc942e70cb417846b6497e4dc18bb3265fd4609aaa6e422a5148175'
AND (
token = 'emrWszI9PPli/DiB1dEnK3/ILQKlUcHVCEdrFtHKLKk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)