UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2ENREmG4T+dBCmKDEksmZs7jYVc5zDllVuwMianDj+Q=' 
WHERE 
  key_id = '68845af9e4c0723618ce72c12559ea0973072065e81b492170f7b972f6fe0774' 
  AND (
    token = '2ENREmG4T+dBCmKDEksmZs7jYVc5zDllVuwMianDj+Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040