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

Query time 0.00038