UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+HfeXFRM77BGsB5PsbAK4MKqbogmYUPDVFdV7V54014=' 
WHERE 
  key_id = 'd0f7f863aee9f4a1bca1b4a4ec327bb0faf4b7b0997c20c26194a76894322e5a' 
  AND (
    token = '+HfeXFRM77BGsB5PsbAK4MKqbogmYUPDVFdV7V54014=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051