UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N2I8S1hKvfKBUMNDTO19fd5q+NDcHUkb8iO8dUCa4nc=' 
WHERE 
  key_id = 'b2ae1b11572f5bd52aa5fa3ae8ae3d297b3a651c9d5ae57a4b27139d2bc3f6ab' 
  AND (
    token = 'N2I8S1hKvfKBUMNDTO19fd5q+NDcHUkb8iO8dUCa4nc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043