UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pDGRX0ZpqNerOe6k2+71vXKGM3UC41fEqCBTu/K9YVI=' 
WHERE 
  key_id = 'f430a33978798171178f0585603e76f2fd3d75def75cb580640bee406b166e38' 
  AND (
    token = 'pDGRX0ZpqNerOe6k2+71vXKGM3UC41fEqCBTu/K9YVI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035