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

Query time 0.00028