UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'e0CmriiWplAqJTIu0o7wGAnFAASeQVjhkIwqrfp5C8I='
WHERE
key_id = '854bcce87143e8ea3e7d321c77d8aa247bc98f52ae552e6261cb6f57596bcfc8'
AND (
token = 'e0CmriiWplAqJTIu0o7wGAnFAASeQVjhkIwqrfp5C8I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)