UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WjZd4FkXViak24guwXv25fVWgnMjClMzEaXP1Q3eyr4=' 
WHERE 
  key_id = '8b627d36934e45905c5104d67d833ed74803b0243fa326f8e4f1b7bb79ec4173' 
  AND (
    token = 'WjZd4FkXViak24guwXv25fVWgnMjClMzEaXP1Q3eyr4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045