UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n/1GfWp316vko4+Ex997je4fSKeo3J0OCHsQivaRmQI=' 
WHERE 
  key_id = 'dc307488a532b57550bf178f95b20a47da5d96596f363dee8fd1ca7e1d13ae75' 
  AND (
    token = 'n/1GfWp316vko4+Ex997je4fSKeo3J0OCHsQivaRmQI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033