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