UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IOZUdI2EySdR0AwcKaFW7T40jxXrQ16nEC80WpV6nwQ='
WHERE
key_id = 'a99df8dfaad9a7c060e660192256b7deaa6d8bda84259370223470bcc2e9bb37'
AND (
token = 'IOZUdI2EySdR0AwcKaFW7T40jxXrQ16nEC80WpV6nwQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)