UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3Y3nFqhGUSQrhZFa4aCYsUlZz5ZQ6AgJodtoA2iLD1Y=' 
WHERE 
  key_id = '5327bb7df222dc86dfced4afed63ca81072490ff371191330efaab22d09ff074' 
  AND (
    token = '3Y3nFqhGUSQrhZFa4aCYsUlZz5ZQ6AgJodtoA2iLD1Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032