UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bFJO+paCUyES29LT1gBRrEE4+TrTj3s7USokrscAixg=' 
WHERE 
  key_id = '3980ca944b6d42e169e496ac4170a829db30b8c155c4d5bfae605afb19407382' 
  AND (
    token = 'bFJO+paCUyES29LT1gBRrEE4+TrTj3s7USokrscAixg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045