UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WRn3GazbrBO/vc5UJ0HrWZMFNptBCZAOMiywvrZs4fI=' 
WHERE 
  key_id = '873ba6123c7b4479c5ad0c066ff20a9314a7380e32998b18b6d075ea226eeeba' 
  AND (
    token = 'WRn3GazbrBO/vc5UJ0HrWZMFNptBCZAOMiywvrZs4fI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046