UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qysOofO2kHRHWHKm3aPD4dvD2VbTy1ZlceQKfRu7sXA=' 
WHERE 
  key_id = '44ed8122655e142a75cb90ff49c3010475d0a961d6a2958994a33724a48bb477' 
  AND (
    token = 'qysOofO2kHRHWHKm3aPD4dvD2VbTy1ZlceQKfRu7sXA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036