UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QEeZ1aKXqinc4Zs4zjxru81/x1FCZer+/3LCfi0G0Dk='
WHERE
key_id = '91231e2eec849f0217eabe6ebb51a0de10fd68818262d19344180759b009f3f9'
AND (
token = 'QEeZ1aKXqinc4Zs4zjxru81/x1FCZer+/3LCfi0G0Dk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)