UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QTmn/pmaoDfHo+wweShTnza12h7DgEse+TFBscBVCTw=' 
WHERE 
  key_id = '01c604aaab0e8ee41ea5db658940a5d612275a3e95d22f092d968e8edcde6953' 
  AND (
    token = 'QTmn/pmaoDfHo+wweShTnza12h7DgEse+TFBscBVCTw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028