UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LhEUZUVlZ2vD1PRvTj5nVtBJsJFe1I8GzGGuMz4GxI4=' 
WHERE 
  key_id = '2326cca77212fb25d96b752cb79900d2bb4de1e45d5ea5f458633b1b54e75c9e' 
  AND (
    token = 'LhEUZUVlZ2vD1PRvTj5nVtBJsJFe1I8GzGGuMz4GxI4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040