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