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

Query time 0.00036