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

Query time 0.00033