UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'H4XeFV05USdTFGreblaBCsKKZC6+iCKlH69oZvutZOg=' 
WHERE 
  key_id = '29d0c9691963854058236bdda7b98e2ec4c332d26b21c59d87c3f331e4e2ac0d' 
  AND (
    token = 'H4XeFV05USdTFGreblaBCsKKZC6+iCKlH69oZvutZOg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036