UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kqKPoSvRbv+ul6eAZJILN8xy2mac48NlWw6+KLswz7g='
WHERE
key_id = 'b3f4b327cf941b87fe955304dd02b96fe527357853a974dbee21043fc5e789ad'
AND (
token = 'kqKPoSvRbv+ul6eAZJILN8xy2mac48NlWw6+KLswz7g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)