UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g2OpEgCg3noP+IxKN0w3MDehmj8i0WO4PtPFJ0c+qzg=' 
WHERE 
  key_id = '81b4967fc6cda50573e9b94bce38ca7bc6ef34f3130e9957c3faab8c879a086c' 
  AND (
    token = 'g2OpEgCg3noP+IxKN0w3MDehmj8i0WO4PtPFJ0c+qzg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021