UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RgWtQ4uggee3sAGiLMz1XwwIZGWUsjQNEIFS4cmDIJA=' 
WHERE 
  key_id = '362ae45da1aed3aa1c75195fc746a62cee90283d92fdea3857a398641235344a' 
  AND (
    token = 'RgWtQ4uggee3sAGiLMz1XwwIZGWUsjQNEIFS4cmDIJA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031