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

Query time 0.00041