UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'G6TJmfTA8nXlHwIM213jBrhb0pJ9KMfKm9q0HCU3PS0='
WHERE
key_id = '667d6785f1d657f0c40c9f3ac45a515fdcc13d17cdca1a7711d0b823129bfb70'
AND (
token = 'G6TJmfTA8nXlHwIM213jBrhb0pJ9KMfKm9q0HCU3PS0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)